// File:    TnCalculatorFactory.cs
// Author:  HT
// Created: Monday, October 17, 2011 3:22:52 PM
// Purpose: Definition of Class TnCalculatorFactory

using System;
using ESRI.ArcGIS.Geodatabase;
using System.Windows.Forms;

namespace Tayninh2011
{
    public sealed class TnCalculatorFactory
    {
        private EnumLoaiThua enumLoaithua;
        private IWorkspaceEdit _workspaceEdit=null;
        private string[,] _userInfo=null;
        private string _environment=String.Empty;
        private static readonly TnCalculatorFactory meClass = new TnCalculatorFactory();

        private TnCalculatorFactory()
        {

        }
        public static TnCalculatorFactory CallMe
        {
            get { return meClass; }
        }

        public void SetParams(IWorkspaceEdit workspace, string environment, string[,] userInfo)
        {
            this._workspaceEdit = workspace;
            this._environment = environment;
            this._userInfo = userInfo;
            //MessageBox.Show(environment);
        }
        //public TnCalculatorFactory(IWorkspaceEdit workspace, string environment)
        //{
        //    this.workspaceEdit = workspace;
        //    this.environment = environment;
        //}

        //public TnCalculatorFactory(IWorkspaceEdit workspace, string environment,string[,] userInfo)
        //{
        //    this.workspaceEdit = workspace;
        //    this.environment = environment;
        //    this.userInfo = userInfo;
        //    MessageBox.Show(environment);
        //}

        public TnToolsCalculator GetCalculator()
        {
            throw new NotImplementedException();
        }
        public TnToolsCalculator GetCalculator(EnumModeCalc mode)
        {
            switch (mode)
            {
                case EnumModeCalc.mode3010:
                    return new TnCalcThua3010(RootForm.SdeWorkspace,RootForm.SdeEnvironment);
                case EnumModeCalc.mode3020:
                    return new TnCalcThua3020(RootForm.SdeWorkspace, RootForm.SdeEnvironment);
                case EnumModeCalc.mode31xxAnd32xx:
                    return new TnCalcThua31xxAnd32xx(RootForm.SdeWorkspace, RootForm.SdeEnvironment,RootForm.UserInfo);
                default:
                    return null;
            }
        }

    }
}
